package com.ruoyi.app.W.service.impl;

import com.ruoyi.app.W.domain.advice;
import com.ruoyi.app.W.mapper.WMapper;
import com.ruoyi.app.W.service.WService;
import com.ruoyi.app.zzq.domain.Partydues;
import com.ruoyi.app.zzq.domain.User;
import com.ruoyi.project.system.domain.SysNotice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class WServiceImpl implements WService {
    @Autowired
    private WMapper wMapper;
    @Autowired
    private WService wService;
    /**
     * 轮播图展示
     * @return
     */
    @Override
    public List<SysNotice> notices(String noticeId) {
        return wMapper.notices(noticeId);
    }

    @Override
    public List<SysNotice> SelectCurrNotice(Integer userId) {
        return wMapper.SelectCurrNotice(userId);
    }

    @Override
    public boolean SubmitAdvice(advice advice) {
        advice.setAdviceDelete(0);
        return wMapper.SubmitAdvice(advice);
    }

    /**
     * 查看所有层级(三层 社区-党支部-街道)  本社区--本街道--本党支部,通过键值对的形式反馈给前端
     */
    @Override
    public Map<String, String> showAdviceHierarchy(String userId) {
        User user = wMapper.showAcceptPartyIds(userId);
        HashMap<String, String> result = new HashMap<>();
        result.put(user.getDeptId(), wMapper.SelectDeptName(user.getDeptId()));
        result.put(user.getPdeptId(), wMapper.SelectDeptName(user.getPdeptId()));
        result.put(String.valueOf(200), wMapper.SelectDeptName(String.valueOf(200)));
        System.out.println("反馈map值"+result);
        return result;
    }

    @Override
    public   List<advice> SelectmyAdvice(String launchPartyId) {
        return wMapper.SelectmyAdvice(launchPartyId);
    }

    @Override
    public   List<advice> SelectAllAdvice() {
        return wMapper.SelectAllAdvice();
    }

    @Override
    public boolean UpdatemyAdvice(advice advice) {
        return wMapper.UpdatemyAdvice(advice);
    }

    @Override
    public boolean DeletemyAdvice(Integer adviceId) {
        return wMapper.DeletemyAdvice(adviceId);
    }

    @Override
    public int SelectIfPays(Integer userId) {
        return wMapper.SelectIfPays(userId);
    }

    @Override
    public List<SysNotice> SelectMyComNotice(String CommunityId) {
        return wMapper.SelectMyComNotice(CommunityId);
    }

    @Override
    public List<SysNotice> SelectCarousele(Integer userId) {
        return wMapper.SelectCarousele(userId);
    }

    @Override
    public boolean MyPayTydue(Date payingTime, Integer userId) {
        return wMapper.MyPayTydue(payingTime,userId);
    }

}
